package com.basic.common.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Slf4j
@Configuration
public class MyWebMvcConfiguration extends WebMvcConfigurationSupport {


    @Value("${uploadPath}")
    private String uploadPath;

    /**
     * 设置静态资源映射
     * @param registry
     */
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/emergencyFile/dispose/**").addResourceLocations("file:" + uploadPath + "dispose/" );
        registry.addResourceHandler("/emergencyFile/plan/**").addResourceLocations("file:" + uploadPath + "plan/*" );

    }

}
